/**
 * 
 */
package com.feib.stms.dao;

import java.util.Date;
import java.util.List;

import com.feib.stms.model.UploadFile;
import com.feib.stms.pagination.PaginatedList;

/**
 * @author Jimmy Liu
 *
 */
public interface UploadFileDao {
	
	public int insert(UploadFile uploadFile );
	
	
	
	/**
	 * 查詢上傳檔案紀錄
	 * @param uploadFile 查詢條件
	 * @param uploaddDateFrom 上傳日期起
	 * @param uploadDateTo 上傳日期迄
	 * @param deliveryDateFrom TODO
	 * @param deliveryDateTo TODO
	 * @param fileFormats 上傳檔案格式(多種)
	 * @param paginatedList 排序與換頁條件
	 * @return 查詢結果
	 */
	public PaginatedList<UploadFile> queryForPaginatedListByUploadFile(UploadFile uploadFile, Date uploaddDateFrom, Date uploadDateTo, Date deliveryDateFrom, Date deliveryDateTo, List<String> fileFormats, PaginatedList paginatedList);

	/**
	 * 
	 * @param uploadFilePk
	 * @return
	 */
	public UploadFile getUploadFileByPk(Long uploadFilePk);
	
	
	/**
	 * 以檔名查詢上傳檔中檢查通過的檔案(Like 查詢)
	 * @param fileName 檔名
	 * @return
	 */
	public List<UploadFile> queryValidateFileByFileName(String fileName);


	/**
	 * 從暫存檔複製到正式區
	 * @param tempUploadFilePk
	 * @param checkCount 所需審查人數
	 * @param confirmCount 所需放行人數
	 * @param preDesignatedAccount TODO
	 * @return
	 */
	public UploadFile copyFromTempUploadFilePk(Long tempUploadFilePk, Integer checkCount, Integer confirmCount, String preDesignatedAccount);
	
	

	/**
	 * 驗資轉交割
	 * @param fromUploadFilePk 驗資檔PK
	 * @param checkCount 所需審查人數
	 * @param confirmCount 所需放行人數
	 * @param preDesignatedAccount TODO
	 * @return
	 */
    public UploadFile copyFromFormat1UploadFilePk(Long fromUploadFilePk,
			Integer checkCount, Integer confirmCount, String preDesignatedAccount);	
	
	
	
	/**
	 * 查詢待處理檔案(待審查待放行取消)
	 * @param uploadFile 查詢條件
	 * @param uploaddDateFrom 上傳日期起
	 * @param uploadDateTo 上傳日期迄
	 * @param fileFormats 上傳檔案格式(多種)
	 * @param paginatedList 排序與換頁條件
	 * @return 查詢結果
	 */
	public PaginatedList<UploadFile> queryForPaginatedListDealUploadFile(UploadFile uploadFile, Date uploaddDateFrom, Date uploadDateTo, List<String> fileFormats, List<Integer> fileStatus, PaginatedList paginatedList);

	
	/**
	 * 更新檔案狀態,並紀錄相關動作最後操作人員(審查放行取消)
	 * @param uploadFile
	 * @return
	 */
	public int updateUploadFileFileStatus(UploadFile uploadFile);
	
	
	
	
	  /**
     * 查詢審查次數
     * @param uploadFilePk
     * @return UploadFile.CheckCount
     */
    public int getUploadFileCheckCount(Long uploadFilePk);
    
    /**
     * 查詢放行次數
     * @param uploadFilePk
     * @return UploadFile.ConfirmCount
     */
    public int getUploadFileConfirmCount(Long uploadFilePk);



 
			
	
}
